package edu.csl.study.shardingsphere.health.service.impl;

import edu.csl.study.shardingsphere.health.entity.HealthLevel;
import edu.csl.study.shardingsphere.health.mapper.HealthLevelMapper;
import edu.csl.study.shardingsphere.health.service.IHealthLevelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 自动生成代码
 * @since 2022-05-19
 */
@Service
public class HealthLevelServiceImpl extends ServiceImpl<HealthLevelMapper, HealthLevel> implements IHealthLevelService {


    @Override
    public void processLevels() throws SQLException {
        baseMapper.insert(new HealthLevel(1L, "level1"));
        baseMapper.insert(new HealthLevel(2L, "level2"));
        baseMapper.insert(new HealthLevel(3L, "level3"));
        baseMapper.insert(new HealthLevel(4L, "level4"));
        baseMapper.insert(new HealthLevel(5L, "level5"));
    }

    @Override
    public List<HealthLevel> list()   {
        return baseMapper.selectList(null);
    }

    @Override
    public void deleteAll() {
        baseMapper.delete(null);
    }
}
